--- validation_api.module Wed Dec 03 21:05:02 2008 +++ validation_api.module Wed Dec 03 21:05:02 2008 @@ -556,17 +556,19 @@ break; case 'regex': // Make argument change, if applicable, in regex code. + $rule = $validator->rule; if (count($arguments) > 0) { foreach ($arguments as $delta => $argument) { - $validator->rule = str_replace('%arguments['. $delta .']', $argument, $validator->rule); + $replace['%arguments['. $delta .']'] = $argument; } + $rule = str_replace(array_keys($replace), array_values($replace), $rule); } // Run the regular expression validation. - if (!preg_match($validator->rule, $value)) { + if (!preg_match($rule, $value)) { $message = $validation_api_field->message; // Set up the substitution strings for the message. $substitutes['%field'] = $element['#name'];